<?php
/* 
PaySEB payment module. This file handles communication with bank.

Copyright (c) 2010 Ingvar Harjaks <ingvarharjaks@gmail.com>
All costs of this development were covered by open source fiendy
company BrightSide OÜ <www.brightside.ee>

PaySEB is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

PaySEB is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PaySEB. If not, see <http://www.gnu.org/licenses/>.
*/

require 'catalog/controller/common/pizza.php';

class ControllerPaymentPaySEB extends Pizza
{

    public $bank = 'payseb';
    public $vk_version = "008";
    public $service_id = "1001";
    public $additional_data = array('VK_CHARSET'=>'utf-8');

    public  function make_mac($data)
    {
        $mac = '';
        foreach ($this->get_service_fields() as $field) {
            if (!array_key_exists($field, $data)) {
                $this->addError("No data to gen mac");
                return false;
            } else {
                $value = $data[$field];
                $mac .= str_pad(strlen(mb_convert_encoding($value, 'utf-8', 'utf-8')), 3, '0',STR_PAD_LEFT) . $value;
            }
        }
        return $mac;
    }



}